
// 百度面试题

async function check(...appidList){
    let timer=null
    return new Promise(async (resolve, reject)=>{

        timer=setTimeout(()=>{
            reject()
            clearTimeout(timer)
            timer=null
        },1*1000)


        let taskList=[]
        for (let appid of appidList){
            taskList.push(checkIsAppInstalled(appid))
        }
        const checkRes=  await Promise.allSettled(taskList)

        let resList= []
        checkRes.forEach(resItem=>{
            resList.push(resItem.value)
        })

        let ans=[]
        for (let index in appidList){
            let appid=appidList[index]
            let status= resList[index]
            ans[appid]=status
        }

        resolve(ans)
    })
}


